package com.yjy;

import io.micrometer.core.instrument.MeterRegistry;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.actuate.autoconfigure.metrics.MeterRegistryCustomizer;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableAsync;

import java.util.ArrayList;
import java.util.List;

@SpringBootApplication
public class Test37Application {
    public static void main(String[] args) {
        SpringApplication.run(Test37Application.class, args);
    }

    /**
     * 为prometheus命名
     *
     * @param applicationName
     * @return
     */
    @Bean
    MeterRegistryCustomizer<MeterRegistry> configure(@Value("${spring.application.name}") String applicationName) {
        System.out.println(">>>applicationName:" + applicationName);
        return register -> {
            register.config().commonTags("application", applicationName);
        };
    }
}
